home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / wsnetbs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  2.2 KB  |  72 lines

  1. /*
  2.  *   wsnetbs.h
  3.  *   Copyright (c) 1994-1995, Microsoft Corp. All rights reserved.
  4.  *
  5.  *   Windows Sockets include file for NETBIOS.  This file contains all
  6.  *   standardized NETBIOS information.  Include this header file after
  7.  *   winsock.h.
  8.  *
  9.  */
  10.  
  11. #ifndef _WSNETBS_
  12. #define _WSNETBS_
  13. #pragma option push -b
  14.  
  15.  
  16. /*
  17.  *   This is the structure of the SOCKADDR structure for NETBIOS.
  18.  *
  19.  */
  20.  
  21. #define NETBIOS_NAME_LENGTH 16
  22.  
  23. typedef struct sockaddr_nb {
  24.     short   snb_family;
  25.     u_short snb_type;
  26.     char    snb_name[NETBIOS_NAME_LENGTH];
  27. } SOCKADDR_NB, *PSOCKADDR_NB,FAR *LPSOCKADDR_NB;
  28.  
  29. /*
  30.  * Bit values for the snb_type field of SOCKADDR_NB.
  31.  *
  32.  */
  33.  
  34. #define NETBIOS_UNIQUE_NAME         (0x0000)
  35. #define NETBIOS_GROUP_NAME          (0x0001)
  36. #define NETBIOS_TYPE_QUICK_UNIQUE   (0x0002)
  37. #define NETBIOS_TYPE_QUICK_GROUP    (0x0003)
  38.  
  39. /*
  40.  * A macro convenient for setting up NETBIOS SOCKADDRs.
  41.  *
  42.  */
  43.  
  44. #define SET_NETBIOS_SOCKADDR(_snb,_type,_name,_port)                          \
  45.     {                                                                         \
  46.         int _i;                                                               \
  47.         (_snb)->snb_family = AF_NETBIOS;                                      \
  48.         (_snb)->snb_type = (_type);                                           \
  49.         for (_i=0; _i<NETBIOS_NAME_LENGTH-1; _i++) {                          \
  50.             (_snb)->snb_name[_i] = ' ';                                       \
  51.         }                                                                     \
  52.         for (_i=0; *((_name)+_i) != '\0' && _i<NETBIOS_NAME_LENGTH-1; _i++) { \
  53.             (_snb)->snb_name[_i] = *((_name)+_i);                             \
  54.         }                                                                     \
  55.         (_snb)->snb_name[NETBIOS_NAME_LENGTH-1] = (_port);                    \
  56.     }
  57.  
  58. /*
  59.  *   To open a NetBIOS socket, call the socket() function as follows:
  60.  *
  61.  *       s = socket( AF_NETBIOS, {SOCK_SEQPACKET|SOCK_DGRAM}, -Lana );
  62.  *
  63.  *   where Lana is the NetBIOS Lana number of interest.  For example, to
  64.  *   open a socket for Lana 2, specify -2 as the "protocol" parameter
  65.  *   to the socket() function.
  66.  *
  67.  */
  68.  
  69.  
  70. #pragma option pop
  71. #endif
  72.